﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Runtime.InteropServices;
using DBTools.DBUpdate.Comm;


namespace DBTools.DBUpdate
{
    public partial class DBInfoForm : FormBase
    {

        string _TargetPath = "";

        public string TargetPath
        {
            get { return _TargetPath; }
            set { _TargetPath = value; }
        }
        public DBInfoForm()
        {
            InitializeComponent();
        }

        private void SettingForm_Load(object sender, EventArgs e)
        {
            //固定窗口大小
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
        }

        private void button_Canel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void button_OK_Click(object sender, EventArgs e)
        {
            SaveData();
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        public void SaveData()
        {
            string _Pathstr = _TargetPath + "\\DbInfo.ini"; 

            List<string> _OutList = new List<string>();
            _OutList.Add("[system]");
            _OutList.Add("key=");
            _OutList.Add("[Info]");
            _OutList.Add("DB=" + textBox_database.Text);
            _OutList.Add("Name=" + textBox_Title.Text);
            Export.TxtExport(_Pathstr, _OutList, "");
            MessageComm.ShowInfo(string.Format("生成文件{0}成功.", _Pathstr));
        }

    }
}
